package vn.demand.dragon.controller
{
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	import vn.demand.dragon.model.vo.Supplier;
	import vn.demand.dragon.view.QuickSupplierMediator;
	
	public class OpenSupplierFormCommand extends SimpleCommand
	{
		override public function execute( note:INotification ) :void    
		{
			if (!facade.hasMediator(QuickSupplierMediator.NAME)) {
				facade.registerMediator(new QuickSupplierMediator(QuickSupplierMediator.NAME));
			}
			var mediator:QuickSupplierMediator = facade.retrieveMediator(QuickSupplierMediator.NAME) as QuickSupplierMediator;
			
			var supplier:Supplier = note.getBody() as Supplier;
			if (null == supplier) {
				supplier = new Supplier();
			}
			mediator.show(supplier);
        }
	}
}